﻿using MediatR;
using SheepStorage.API.Application.Command.SheepMomPergnantCommand;
using SheepStorage.API.Application.Command.YourTableNameCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepMomPergnantHandler
{
    public class SheepMomPergnantBackfillCommandHandler : IRequestHandler<SheepMomPergnantBackfillCommand, Results<SheepMomPergnant>>
    {
        private readonly ISheepMomPergnantService _sheepMomPergnantService;
        public SheepMomPergnantBackfillCommandHandler(ISheepMomPergnantService sheepMomPergnantService)
        {
            _sheepMomPergnantService = sheepMomPergnantService;
        }
        public async Task<Results<SheepMomPergnant>> Handle(SheepMomPergnantBackfillCommand request, CancellationToken cancellationToken)
        {
            return Results<SheepMomPergnant>.DataResult(await _sheepMomPergnantService.BackfillSheepMomPergnant(request.MomPergnantId));
        }
    }
}
